home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / interapplication comm / folder watching / fw receiver / lists.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-23  |  1.9 KB  |  105 lines

  1. /*
  2.     File:        Lists.c
  3.  
  4.     Contains:    List Manager stuff and associated routines
  5.  
  6.     Written by: Chris White    
  7.  
  8.     Copyright:    Copyright © 1995-1999 by Apple Computer, Inc., All Rights Reserved.
  9.  
  10.                 You may incorporate this Apple sample source code into your program(s) without
  11.                 restriction. This Apple sample source code has been provided "AS IS" and the
  12.                 responsibility for its operation is yours. You are not permitted to redistribute
  13.                 this Apple sample source code as "Apple sample source code" after having made
  14.                 changes. If you're going to re-distribute the source, we require that you make
  15.                 it clear in the source that the code was descended from Apple sample source
  16.                 code, but that you've made changes.
  17.  
  18.     Change History (most recent first):
  19.                 7/21/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  20.                 
  21.  
  22. */
  23.  
  24.  
  25. #pragma segment Core
  26.  
  27.  
  28. // System Includes
  29.  
  30.  
  31.  
  32. // Application Includes
  33.  
  34. #ifndef __BAREBONES__
  35.     #include "BareBones.h"
  36. #endif
  37.  
  38. #ifndef __PROTOTYPES__
  39.     #include "Prototypes.h"
  40. #endif
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47. Boolean HandleListClick ( WindowRef theWindow, EventRecord* event )
  48. {
  49.     Point        localPt;
  50.     ListRef        theList;
  51.     
  52.     
  53.     localPt = event->where;
  54.     GlobalToLocal ( &localPt );
  55.     theList = (ListRef) GetWRefCon ( theWindow );
  56.     
  57.     if ( (*theList)->lActive == true )
  58.     {
  59.         Rect    listRect;
  60.         
  61.         GetListRect ( theList, &listRect );
  62.         // Include the scroll bars
  63.         listRect.right += 15;
  64.         
  65.         if ( PtInRect ( localPt, &listRect ) )
  66.             LClick ( localPt, event->modifiers, theList );
  67.             
  68.     }
  69.     
  70.     return true;
  71. }
  72.  
  73.  
  74.  
  75. void AddToList ( ListRef theList, Str255 theString )
  76. {
  77.     Rect    dataRect;
  78.     Cell    theCell;
  79.     short    nuRow;
  80.     
  81.     #if DEBUGGING
  82.     if ( theList == nil ) DebugStr ( "\p theList == nil");
  83.     #endif
  84.     
  85.     dataRect = (*theList)->dataBounds;
  86.     nuRow = LAddRow ( 1, dataRect.bottom, theList );
  87.     SetPt ( &theCell, 0, nuRow );
  88.     LSetCell ( &theString[1], theString[0], theCell, theList );
  89.     
  90.     return;
  91. }
  92.  
  93.  
  94.  
  95. void GetListRect ( ListRef theList, Rect* theRect )
  96. {
  97.     *theRect = (*theList)->rView;
  98. }
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.